<template>
  <h2 align="left">实验预约申请:</h2>
  <div style="margin-left: 50px">
    <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="200px" label-position="left" style="width: 700px">
      <el-form-item label="项目编号:" prop="projectno">
        <el-input v-model="ruleForm.projectno" v-bind:readonly="ruleForm.readonly1"></el-input>
      </el-form-item>
      <el-form-item label="项目名称:" prop="projectname">
        <el-input v-model="ruleForm.projectname" v-bind:readonly="ruleForm.readonly1"></el-input>
      </el-form-item>
      <el-form-item label="实验编号:" prop="experimentno">
        <el-input v-model="ruleForm.experimentno" v-bind:readonly="ruleForm.readonly1"></el-input>
      </el-form-item>
      <el-form-item label="实验名称:" prop="experimentname">
        <el-input v-model="ruleForm.experimentname" v-bind:readonly="ruleForm.readonly1"></el-input>
      </el-form-item>
      <el-form-item label="独立PI编号:" prop="PIno">
<!--        <el-input v-model="ruleForm.PIno" v-bind:readonly="ruleForm.readonly1"></el-input>-->
        <el-select v-model="ruleForm.PIno" @click="newPIASListPI()" @change="newPIname()" placeholder="请选择独立PI编号" v-bind:readonly="ruleForm.readonly1" style="width: 500px">
          <el-option
              v-for="item in ruleForm.PIASListPI"
              :key="item.PIuser_id"
              :value="item.PIuser_id">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="独立PI姓名:" prop="PIname">
        <el-input v-model="ruleForm.PIname" readonly="true"></el-input>
      </el-form-item>
      <el-form-item label="实验助理编号:" prop="assistantno">
<!--        <el-input v-model="ruleForm.assistantno" v-bind:readonly="ruleForm.readonly1"></el-input>-->
        <el-select v-model="ruleForm.assistantno" @click="newPIASListAS()" @change="newASname()" placeholder="请选择实验助理编号" v-bind:readonly="ruleForm.readonly1" style="width: 500px">
          <el-option
              v-for="item in ruleForm.PIASListAS"
              :key="item.ASuser_id"
              :value="item.ASuser_id">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="实验助理姓名:" prop="assistantname">
        <el-input v-model="ruleForm.assistantname" readonly="true"></el-input>
      </el-form-item>
      <el-button type="primary" @click="addexperimentbutton()">添加实验</el-button>
      <el-button type="danger" @click="delexperimentbutton()">删除实验</el-button>
    </el-form>
  </div>

  <h2 align="left">实验步骤更改:</h2>
  <div style="margin-left: 50px">
    <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="200px" label-position="left" style="width: 700px">
<!--      <el-form-item label="实验-步骤唯一标识:" prop="experimentstepno">-->
<!--        <el-input v-model="ruleForm.experimentstepno"></el-input>-->
<!--      </el-form-item>-->
      <el-form-item label="步骤编号:" prop="stepno">
<!--        <el-input v-model="ruleForm.stepno"></el-input>-->
        <el-select v-model="ruleForm.stepno" @change="newstepno()" placeholder="请选择单元编号" style="width: 500px">
          <el-option
              v-for="item in ruleForm.stepnoList"
              :key="item.id"
              :value="item.id">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="步骤名称:" prop="stepname">
        <el-input v-model="ruleForm.stepname"></el-input>
      </el-form-item>
      <el-form-item label="优先等级:" prop="steppriority">
        <el-input v-model="ruleForm.steppriority"></el-input>
      </el-form-item>
      <el-form-item label="步骤时长:" prop="steptime">
        <el-input v-model="ruleForm.steptime"></el-input>
      </el-form-item>
      <el-button type="primary" @click="addstepbutton()">添加步骤</el-button>
      <h6></h6>
      <el-form-item label="实验-步骤唯一标识:" prop="delsteono">
<!--        <el-input v-model="ruleForm.delsteono"></el-input>-->
        <el-select v-model="ruleForm.delsteono" @click="getexperimentstep()" @change="newdelexpstep()" placeholder="请选择唯一标识" style="width: 500px">
          <el-option
              v-for="item in ruleForm.experimentstepList"
              :key="item.experiment_step_id1"
              :value="item.experiment_step_id1">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="步骤编号:" prop="delstep_id1">
        <el-input v-model="ruleForm.delstep_id1"></el-input>
      </el-form-item>
      <el-form-item label="优先等级:" prop="delpriority1">
        <el-input v-model="ruleForm.delpriority1"></el-input>
      </el-form-item>
      <el-form-item label="步骤时长:" prop="delstep_time_hour1">
        <el-input v-model="ruleForm.delstep_time_hour1"></el-input>
      </el-form-item>
      <el-button type="danger" @click="delstepbutton()">删除步骤</el-button>
    </el-form>
  </div>

  <h2 align="left">单元材料添加:</h2>
  <div style="margin-left: 50px">
    <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="200px" label-position="left" style="width: 700px">
      <el-form-item label="实验-步骤唯一标识:" prop="unitexpstepno">
<!--        <el-input v-model="ruleForm.unitexpstepno"></el-input>-->
        <el-select v-model="ruleForm.unitexpstepno" @click="getexperimentstep()" @change="newunitstep()" placeholder="请选择唯一标识" style="width: 500px">
          <el-option
              v-for="item in ruleForm.experimentstepList"
              :key="item.experiment_step_id1"
              :value="item.experiment_step_id1">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="步骤编号:" prop="unitstepno">
        <el-input v-model="ruleForm.unitstepno"></el-input>
      </el-form-item>
      <el-form-item label="单元编号:" prop="unitno">
<!--        <el-input v-model="ruleForm.unitno"></el-input>-->
        <el-select v-model="ruleForm.unitno" @change="newunitname()" placeholder="请选择单元编号" style="width: 500px">
          <el-option
              v-for="item in ruleForm.unitList"
              :key="item.unitList_id"
              :value="item.unitList_id">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="单元名称:" prop="unitname">
        <el-input v-model="ruleForm.unitname"></el-input>
      </el-form-item>
      <el-form-item label="资源种类:" prop="type">
<!--        <el-input v-model="ruleForm.type"></el-input>-->
        <el-select v-model="ruleForm.type" @change="selectrestype()" placeholder="请选择资源种类" style="width: 500px">
          <el-option
              v-for="item in ruleForm.restypeList"
              :key="item"
              :value="item">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="资源编号:" prop="resno">
<!--        <el-input v-model="ruleForm.resno"></el-input>-->
        <el-select v-model="ruleForm.resno" @change="nowuseame()" placeholder="请选择资源编号" style="width: 500px">
          <el-option
              v-for="item in ruleForm.nowuseList"
              :key="item.id"
              :value="item.id">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="资源名称:" prop="resname">
        <el-input v-model="ruleForm.resname"></el-input>
      </el-form-item>
      <el-form-item label="资源数量:" prop="resnum">
        <el-input v-model="ruleForm.resnum"></el-input>
      </el-form-item>
      <el-button type="primary" @click="addequipmentbutton()">添加资源</el-button>
      <h6></h6>
      <el-form-item label="实验-步骤唯一标识:" prop="delunitexpstepno">
<!--        <el-input v-model="ruleForm.delunitexpstepno"></el-input>-->
        <el-select v-model="ruleForm.delunitexpstepno" @click="getexperimentstep()" placeholder="请选择唯一标识" style="width: 500px">
          <el-option
              v-for="item in ruleForm.experimentstepList"
              :key="item.experiment_step_id1"
              :value="item.experiment_step_id1">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="单元编号:" prop="delunitno">
<!--        <el-input v-model="ruleForm.delunitno"></el-input>-->
        <el-select v-model="ruleForm.delunitno" placeholder="请选择单元编号" style="width: 500px">
          <el-option
              v-for="item in ruleForm.unitList"
              :key="item.unitList_id"
              :value="item.unitList_id">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="资源种类:" prop="delrestype">
<!--        <el-input v-model="ruleForm.delrestype"></el-input>-->
        <el-select v-model="ruleForm.delrestype" @change="selectrestype2()" placeholder="请选择资源种类" style="width: 500px">
          <el-option
              v-for="item in ruleForm.restypeList"
              :key="item"
              :value="item">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="资源编号:" prop="delresno">
<!--        <el-input v-model="ruleForm.delresno"></el-input>-->
        <el-select v-model="ruleForm.delresno" placeholder="请选择资源编号" style="width: 500px">
          <el-option
              v-for="item in ruleForm.nowuseList2"
              :key="item.id"
              :value="item.id">
          </el-option>
        </el-select>
      </el-form-item>
      <el-button type="danger" @click="delequipmentbutton()">删除资源</el-button>
      <h6></h6>
      <el-button type="primary" @click="checkok()">完成申请</el-button>
    </el-form>
  </div>
</template>

<script>
import {get} from "@/utils/http";
import {ElMessage} from "element-plus";

export default {
  name: "AddExperiment",
  data() {
    return {
      ruleForm: {
        projectno: '',
        projectname: '',
        experimentno: '',
        experimentname: '',
        PIno: '',
        PIname: '',
        assistantno: '',
        assistantname: '',
        delprojectno: '',
        delexperimentno: '',

        // experimentstepno: '',
        stepno: '',
        stepname: '',
        steppriority: '',
        steptime: '',
        delsteono: '',
        delstep_id1: '',
        delpriority1: '',
        delstep_time_hour1: '',

        unitexpstepno: '',
        unitstepno: '',
        unitno: '',
        unitname: '',
        type: '',
        resno: '',
        resname: '',
        resnum: '',
        delunitexpstepno: '',
        delunitno: '',
        delrestype: '',
        delresno: '',

        readonly1: false,

        unitList:[],

        restypeList: ['SAMPLE','MATERIAL','ANIMAL'],
        yangpinList: [],
        haocaiList: [],
        yiqiList: [],
        nowuseList: [],
        nowuseList2: [],

        stepnoList: [],
        experimentstepList: [],

        PIASList: [],
        PIASListPI: [],
        PIASListAS: [],
      },
      rules: {
        projectno:[
          { required: true, message: '请输入项目编号', trigger: 'blur' }
        ],
        projectname:[
          { required: true, message: '请输入项目名称', trigger: 'blur' }
        ],
        experimentno:[
          { required: true, message: '请输入实验编号', trigger: 'blur' }
        ],
        experimentname:[
          { required: true, message: '请输入实验名称', trigger: 'blur' }
        ],
        PIno:[
          { required: true, message: '请输入独立PI编号', trigger: 'blur' }
        ],
        PIname:[
          { required: true, message: '请输入独立PI名称', trigger: 'blur' }
        ],
        assistantno:[
          { required: true, message: '请输入实验助理编号', trigger: 'blur' }
        ],
        assistantname:[
          { required: true, message: '请输入实验助理名称', trigger: 'blur' }
        ],
        delprojectno:[
          { required: true, message: '请输入项目编号', trigger: 'blur' }
        ],
        delexperimentno:[
          { required: true, message: '请输入实验编号', trigger: 'blur' }
        ],
        experimentstepno:[
          { required: true, message: '请输入唯一标识', trigger: 'blur' }
        ],
        stepno:[
          { required: true, message: '请输入步骤编号', trigger: 'blur' }
        ],
        stepname:[
          { required: true, message: '请输入步骤名称', trigger: 'blur' }
        ],
        steppriority:[
          { required: true, message: '请输入优先等级', trigger: 'blur' }
        ],
        steptime:[
          { required: true, message: '请输入步骤时长', trigger: 'blur' }
        ],
        delsteono:[
          { required: true, message: '请输入步骤编号', trigger: 'blur' }
        ],
        unitexpstepno:[
          { required: true, message: '请输入唯一标识', trigger: 'blur' }
        ],
        unitno:[
          { required: true, message: '请输入单元编号', trigger: 'blur' }
        ],
        unitname:[
          { required: true, message: '请输入单元名称', trigger: 'blur' }
        ],
        type:[
          { required: true, message: '请输入资源种类', trigger: 'blur' }
        ],
        resno:[
          { required: true, message: '请输入资源编号', trigger: 'blur' }
        ],
        resname:[
          { required: true, message: '请输入资源名称', trigger: 'blur' }
        ],
        resnum:[
          { required: true, message: '请输入资源数量', trigger: 'blur' }
        ],
        delunitexpstepno:[
          { required: true, message: '请输入唯一标识', trigger: 'blur' }
        ],
        delunitno:[
          { required: true, message: '请输入单元编号', trigger: 'blur' }
        ],
        delrestype:[
          { required: true, message: '请输入资源种类', trigger: 'blur' }
        ],
        delresno:[
          { required: true, message: '请输入资源编号', trigger: 'blur' }
        ],
        unitstepno:[
          { required: true, message: '请输入资源编号', trigger: 'blur' }
        ],
      }
    };
  },
  created(){
    this.getstep();
    this.getyangpin();
    this.gethaocai();
    this.getyiqi();
    this.getunitlist();
    this.getPIASlist();
  },
  methods: {
    newPIname(){
      for(var i=0;i<this.ruleForm.PIASListPI.length;i++){
        if(this.ruleForm.PIno == this.ruleForm.PIASListPI[i].PIuser_id){
          this.ruleForm.PIname = this.ruleForm.PIASListPI[i].PIuser_name;
          break;
        }
      }
    },
    newASname(){
      for(var i=0;i<this.ruleForm.PIASListAS.length;i++){
        if(this.ruleForm.assistantno == this.ruleForm.PIASListAS[i].ASuser_id){
          this.ruleForm.assistantname = this.ruleForm.PIASListAS[i].ASuser_name;
          break;
        }
      }
    },
    newPIASListPI(){
      this.ruleForm.PIASListPI=[];
      for(var i=0;i<this.ruleForm.PIASList.length;i++){
        if(this.ruleForm.PIASList[i].PIASuser_type == 3 && this.ruleForm.PIASList[i].PIASproject_id == this.ruleForm.projectno){
          this.ruleForm.PIASListPI.push({
            PIuser_id: this.ruleForm.PIASList[i].PIASuser_id,
            PIuser_name: this.ruleForm.PIASList[i].PIASuser_name
          })
        }
      }
    },
    newPIASListAS(){
      this.ruleForm.PIASListAS=[];
      for(var i=0;i<this.ruleForm.PIASList.length;i++){
        if(this.ruleForm.PIASList[i].PIASuser_type == 4 && this.ruleForm.PIASList[i].PIASproject_id == this.ruleForm.projectno){
          this.ruleForm.PIASListAS.push({
            ASuser_id: this.ruleForm.PIASList[i].PIASuser_id,
            ASuser_name: this.ruleForm.PIASList[i].PIASuser_name
          })
        }
      }
    },
    checkok(){
      let that = this;
      that.$router.push({
        name: "MainPage",
      });
      // get('/changeexpstatejs', {
      //   experimentno: that.ruleForm.experimentno,
      // }).then(function (res) {
      //   if (res.code === 1) {
      //     that.$router.push({
      //       name: "MainPage",
      //     })
      //     ElMessage.success({
      //       showClose: true,
      //       message: "提交成功",
      //       type: "success",
      //       center: true
      //     })
      //   } else {
      //     ElMessage.warning({
      //       showClose: true,
      //       message: "提交失败",
      //       type: "warning",
      //       center: true
      //     })
      //   }
      // });
    },
    newunitname(){
      for(var i=0;i<this.ruleForm.unitList.length;i++){
        if(this.ruleForm.unitList[i].unitList_id == this.ruleForm.unitno){
          this.ruleForm.unitname = this.ruleForm.unitList[i].unitList_name;
          break;
        }
      }
    },
    nowuseame(){
      if(this.ruleForm.type == 'SAMPLE'){
        for(var i=0;i<this.ruleForm.yangpinList.length;i++){
          if(this.ruleForm.yangpinList[i].id == this.ruleForm.resno){
            this.ruleForm.resname = this.ruleForm.yangpinList[i].value;
            break;
          }
        }
      }
      else if(this.ruleForm.type == 'MATERIAL'){
        for(i=0;i<this.ruleForm.haocaiList.length;i++){
          if(this.ruleForm.haocaiList[i].id == this.ruleForm.resno){
            this.ruleForm.resname = this.ruleForm.haocaiList[i].value;
            break;
          }
        }
      }
      else if(this.ruleForm.type == 'ANIMAL'){
        for(i=0;i<this.ruleForm.yiqiList.length;i++){
          if(this.ruleForm.yiqiList[i].id == this.ruleForm.resno){
            this.ruleForm.resname = this.ruleForm.yiqiList[i].value;
            break;
          }
        }
      }
    },
    selectrestype(){
      if(this.ruleForm.type == 'SAMPLE'){
        this.ruleForm.nowuseList = this.ruleForm.yangpinList;
      }
      else if(this.ruleForm.type == 'MATERIAL'){
        this.ruleForm.nowuseList = this.ruleForm.haocaiList;
      }
      else if(this.ruleForm.type == 'ANIMAL'){
        this.ruleForm.nowuseList = this.ruleForm.yiqiList;
      }
    },
    selectrestype2(){
      if(this.ruleForm.delrestype == 'SAMPLE'){
        this.ruleForm.nowuseList2 = this.ruleForm.yangpinList;
      }
      else if(this.ruleForm.type == 'MATERIAL'){
        this.ruleForm.nowuseList2 = this.ruleForm.haocaiList;
      }
      else if(this.ruleForm.type == 'ANIMAL'){
        this.ruleForm.nowuseList2 = this.ruleForm.yiqiList;
      }
    },
    newstepno(){
      for(var i=0;i<this.ruleForm.stepnoList.length;i++){
        if(this.ruleForm.stepnoList[i].id == this.ruleForm.stepno){
          this.ruleForm.stepname = this.ruleForm.stepnoList[i].value;
          break;
        }
      }
    },
    newunitstep(){
      for(var i=0;i<this.ruleForm.experimentstepList.length;i++){
        if(this.ruleForm.experimentstepList[i].experiment_step_id1 == this.ruleForm.unitexpstepno){
          this.ruleForm.unitstepno = this.ruleForm.experimentstepList[i].step_id1;
          break;
        }
      }
    },
    newdelexpstep(){
      for(var i=0;i<this.ruleForm.experimentstepList.length;i++){
        if(this.ruleForm.experimentstepList[i].experiment_step_id1 == this.ruleForm.delsteono){
          this.ruleForm.delstep_id1 = this.ruleForm.experimentstepList[i].step_id1;
          this.ruleForm.delpriority1 = this.ruleForm.experimentstepList[i].priority1;
          this.ruleForm.delstep_time_hour1 = this.ruleForm.experimentstepList[i].step_time_hour1;
          break;
        }
      }
    },
    addexperimentbutton(){
      let that = this;
      get('/addexperimentbuttonjs', {
        projectno: that.ruleForm.projectno,
        projectname: that.ruleForm.projectname,
        experimentno: that.ruleForm.experimentno,
        experimentname: that.ruleForm.experimentname,
        PIno: that.ruleForm.PIno,
        assistantno: that.ruleForm.assistantno
      }).then(function (res) {
        if (res.code === 1) {
          that.ruleForm.readonly1 = true;
          ElMessage.success({
            showClose: true,
            message: "实验添加成功",
            type: "success",
            center: true
          })
        } else {
          ElMessage.warning({
            showClose: true,
            message: "实验添加失败",
            type: "warning",
            center: true
          })
        }
      });
    },
    delexperimentbutton(){
      let that = this;
      get('/delexperimentbuttonjs', {
        experimentno: that.ruleForm.experimentno,
      }).then(function (res) {
        if (res.code === 1) {
          ElMessage.success({
            showClose: true,
            message: "实验删除成功",
            type: "success",
            center: true
          })
        } else {
          ElMessage.warning({
            showClose: true,
            message: "实验删除失败",
            type: "warning",
            center: true
          })
        }
      });
      this.$router.push({
        name: "MainPage",
      })
    },
    addstepbutton(){
      let that = this;
      get('/addstepbuttonjs', {
        experimentstepno: that.ruleForm.experimentstepno,
        experimentno: that.ruleForm.experimentno,
        stepno: that.ruleForm.stepno,
        steppriority: that.ruleForm.steppriority,
        steptime: that.ruleForm.steptime,
      }).then(function (res) {
        if (res.code === 1) {
          ElMessage.success({
            showClose: true,
            message: "步骤添加成功",
            type: "success",
            center: true
          })
        } else {
          ElMessage.warning({
            showClose: true,
            message: "步骤添加失败",
            type: "warning",
            center: true
          })
        }
      });
    },
    delstepbutton(){
      let that = this;
      get('/delstepbuttonjs', {
        delsteono: that.ruleForm.delsteono,
      }).then(function (res) {
        if (res.code === 1) {
          ElMessage.success({
            showClose: true,
            message: "步骤删除成功",
            type: "success",
            center: true
          })
        } else {
          ElMessage.warning({
            showClose: true,
            message: "步骤删除失败",
            type: "warning",
            center: true
          })
        }
      });
    },
    addequipmentbutton(){
      let that = this;
      get('/addresbuttonjs', {
        unitexpstepno: that.ruleForm.unitexpstepno,
        unitno: that.ruleForm.unitno,
        type: that.ruleForm.type,
        resno: that.ruleForm.resno,
        resnum: that.ruleForm.resnum,
      }).then(function (res) {
        if (res.code === 1) {
          ElMessage.success({
            showClose: true,
            message: "资源添加成功",
            type: "success",
            center: true
          })
        } else {
          ElMessage.warning({
            showClose: true,
            message: "资源添加失败",
            type: "warning",
            center: true
          })
        }
      });
    },
    delequipmentbutton(){
      let that = this;
      get('/delresbuttonjs', {
        delunitexpstepno: that.ruleForm.delunitexpstepno,
        delunitno: that.ruleForm.delunitno,
        delrestype: that.ruleForm.delrestype,
        delresno: that.ruleForm.delresno,
      }).then(function (res) {
        if (res.code === 1) {
          ElMessage.success({
            showClose: true,
            message: "资源删除成功",
            type: "success",
            center: true
          })
        } else {
          ElMessage.warning({
            showClose: true,
            message: "资源删除失败",
            type: "warning",
            center: true
          })
        }
      });
    },
    getstep(){
      let that = this;
      get('/stepnonamejs', {
      }).then(function (res) {
        if (res.code === 1) {
          that.ruleForm.stepnoList = [];
          for(var i=0;i<res.data.length;i++){
            that.ruleForm.stepnoList.push({id: res.data[i].stepno, value: res.data[i].stepname});
          }
          ElMessage.success({
            showClose: true,
            message: "页面加载成功",
            type: "success",
            center: true
          })
        } else {
          ElMessage.warning({
            showClose: true,
            message: "页面加载失败",
            type: "warning",
            center: true
          })
        }
      });
    },
    getyangpin(){
      let that = this;
      get('/getyangpinjs', {
      }).then(function (res) {
        if (res.code === 1) {
          that.ruleForm.yangpinList = [];
          for(var i=0;i<res.data.length;i++){
            that.ruleForm.yangpinList.push({id: res.data[i].yangpinid, value: res.data[i].yangpinname});
          }
          ElMessage.success({
            showClose: true,
            message: "页面加载成功",
            type: "success",
            center: true
          })
        } else {
          ElMessage.warning({
            showClose: true,
            message: "页面加载失败",
            type: "warning",
            center: true
          })
        }
      });
    },
    gethaocai(){
      let that = this;
      get('/gethaocaijs', {
      }).then(function (res) {
        if (res.code === 1) {
          that.ruleForm.haocaiList = [];
          for(var i=0;i<res.data.length;i++){
            that.ruleForm.haocaiList.push({id: res.data[i].yangpinid, value: res.data[i].yangpinname});
          }
          ElMessage.success({
            showClose: true,
            message: "页面加载成功",
            type: "success",
            center: true
          })
        } else {
          ElMessage.warning({
            showClose: true,
            message: "页面加载失败",
            type: "warning",
            center: true
          })
        }
      });
    },
    getyiqi(){
      let that = this;
      get('/getyiqijs', {
      }).then(function (res) {
        if (res.code === 1) {
          that.ruleForm.yiqiList = [];
          for(var i=0;i<res.data.length;i++){
            that.ruleForm.yiqiList.push({id: res.data[i].yangpinid, value: res.data[i].yangpinname});
          }
          ElMessage.success({
            showClose: true,
            message: "页面加载成功",
            type: "success",
            center: true
          })
        } else {
          ElMessage.warning({
            showClose: true,
            message: "页面加载失败",
            type: "warning",
            center: true
          })
        }
      });
    },
    getexperimentstep(){
      let that = this;
      get('/getexperimentstepjs', {
        experimentno: that.ruleForm.experimentno,
      }).then(function (res) {
        if (res.code === 1) {
          that.ruleForm.experimentstepList = [];
          for(var i=0;i<res.data.length;i++){
            that.ruleForm.experimentstepList.push({
              experiment_step_id1: res.data[i].experimentstepno,
              step_id1: res.data[i].stepno,
              priority1: res.data[i].steppriority,
              step_time_hour1: res.data[i].steptime });
          }
          ElMessage.success({
            showClose: true,
            message: "数据更新成功",
            type: "success",
            center: true
          })
        } else {
          ElMessage.warning({
            showClose: true,
            message: "数据更新失败",
            type: "warning",
            center: true
          })
        }
      });
    },
    getunitlist(){
      let that = this;
      get('/getunitlistjs', {
      }).then(function (res) {
        if (res.code === 1) {
          that.ruleForm.unitList = [];
          for(var i=0;i<res.data.length;i++){
            that.ruleForm.unitList.push({
              unitList_id: res.data[i].yangpinid,
              unitList_name: res.data[i].yangpinname});
          }
          ElMessage.success({
            showClose: true,
            message: "数据更新成功",
            type: "success",
            center: true
          })
        } else {
          ElMessage.warning({
            showClose: true,
            message: "数据更新失败",
            type: "warning",
            center: true
          })
        }
      });
    },
    getPIASlist(){
      let that = this;
      get('/piasjs', {
      }).then(function (res) {
        if (res.code === 1) {
          that.ruleForm.PIASList = [];
          for(var i=0;i<res.data.length;i++){
            that.ruleForm.PIASList.push({
              PIASuser_id: res.data[i].user_id,
              PIASuser_name: res.data[i].user_name,
              PIASuser_type: res.data[i].user_type,
              PIASproject_id: res.data[i].project_id});
          }
          ElMessage.success({
            showClose: true,
            message: "数据更新成功",
            type: "success",
            center: true
          })
        } else {
          ElMessage.warning({
            showClose: true,
            message: "数据更新失败",
            type: "warning",
            center: true
          })
        }
      });
    },
  }
}
</script>

<style scoped>

</style>


